class Solution {
public:
    int reachNumber(int target) {
        if(target<0)target=-target;
        int sum=0,n=0;
        while(sum<target)
        {
            n++;
            sum+=n;
        }
        if(sum==target)return n;
        else if(sum-target%2==0)return n;
        else if(n%2==0)return n+1;
        returnq n+2;
    }
};